/**
 */
package org.xtext.mydsl.scheduler.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.xtext.mydsl.scheduler.Inaguracion;
import org.xtext.mydsl.scheduler.SchedulerPackage;
import org.xtext.mydsl.scheduler.Time;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Inaguracion</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.mydsl.scheduler.impl.InaguracionImpl#getHorario <em>Horario</em>}</li>
 *   <li>{@link org.xtext.mydsl.scheduler.impl.InaguracionImpl#getMinutos <em>Minutos</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class InaguracionImpl extends MinimalEObjectImpl.Container implements Inaguracion
{
  /**
   * The cached value of the '{@link #getHorario() <em>Horario</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getHorario()
   * @generated
   * @ordered
   */
  protected Time horario;

  /**
   * The default value of the '{@link #getMinutos() <em>Minutos</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMinutos()
   * @generated
   * @ordered
   */
  protected static final int MINUTOS_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getMinutos() <em>Minutos</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMinutos()
   * @generated
   * @ordered
   */
  protected int minutos = MINUTOS_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected InaguracionImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return SchedulerPackage.Literals.INAGURACION;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Time getHorario()
  {
    return horario;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetHorario(Time newHorario, NotificationChain msgs)
  {
    Time oldHorario = horario;
    horario = newHorario;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SchedulerPackage.INAGURACION__HORARIO, oldHorario, newHorario);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHorario(Time newHorario)
  {
    if (newHorario != horario)
    {
      NotificationChain msgs = null;
      if (horario != null)
        msgs = ((InternalEObject)horario).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SchedulerPackage.INAGURACION__HORARIO, null, msgs);
      if (newHorario != null)
        msgs = ((InternalEObject)newHorario).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SchedulerPackage.INAGURACION__HORARIO, null, msgs);
      msgs = basicSetHorario(newHorario, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, SchedulerPackage.INAGURACION__HORARIO, newHorario, newHorario));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getMinutos()
  {
    return minutos;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMinutos(int newMinutos)
  {
    int oldMinutos = minutos;
    minutos = newMinutos;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, SchedulerPackage.INAGURACION__MINUTOS, oldMinutos, minutos));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case SchedulerPackage.INAGURACION__HORARIO:
        return basicSetHorario(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case SchedulerPackage.INAGURACION__HORARIO:
        return getHorario();
      case SchedulerPackage.INAGURACION__MINUTOS:
        return getMinutos();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case SchedulerPackage.INAGURACION__HORARIO:
        setHorario((Time)newValue);
        return;
      case SchedulerPackage.INAGURACION__MINUTOS:
        setMinutos((Integer)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case SchedulerPackage.INAGURACION__HORARIO:
        setHorario((Time)null);
        return;
      case SchedulerPackage.INAGURACION__MINUTOS:
        setMinutos(MINUTOS_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case SchedulerPackage.INAGURACION__HORARIO:
        return horario != null;
      case SchedulerPackage.INAGURACION__MINUTOS:
        return minutos != MINUTOS_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (minutos: ");
    result.append(minutos);
    result.append(')');
    return result.toString();
  }

} //InaguracionImpl
